/*
 * Copyright (C) Francisco Morero Peyrona. All rights reserved.
 *
 * This software is published under the terms of Open Source
 * License version 1.1, a copy of which has been included with this
 * distribution in the License.txt file.
 */

package agents;

import javax.swing.tree.*;

import jdbcmanager.dbtools.datatypes.*;

/**
 * Agent Meta Data for "Type 4 JDBC driver for Sybase ASE" driver.
 *  
 * @author jmss
 */
public final class AgentMetaDataSybase extends AgentMetaDataDefault
{   
   public DbEntityDescriptor[] getTableNames( String sCatalog, String sSchema, String[] asType )
   {
      if( sSchema == null )
         sSchema = "dbo";

      return super.getTables( sCatalog, sSchema, null, asType );
   }
   
   public DefaultMutableTreeNode[] getProcedureTree( String sCatalog, String sSchema )
   {
      DefaultMutableTreeNode[] aoRet = super.getProcedureTree( sCatalog, sSchema );
      
      for( int n = 0; n < aoRet.length; n++ )
      {
         DbEntityDescriptor ded = (DbEntityDescriptor) aoRet[n].getUserObject();
                            ded.setName( ded.getName().substring( 0, ded.getName().indexOf( ';' ) ) );
      }

      return aoRet;
   }
}

